window.onload = function () {
    //导航栏
    var navOne = document.querySelectorAll(".nav_one>li ")
    var dropDown = document.querySelectorAll(".nav_one>li>ul")
    for (var i = 0; i < navOne.length; i++) {
        navOne[i].addEventListener("mouseover", function () {
            // //hover 效果  排他
            for (var i = 0; i < navOne.length; i++) {
                navOne[i].className = ""
                for (j = 0; j < navOne.length; j++) {
                    this.className = "active"
                }
            }
            //导航隐藏的显示
            if (this.children[1]) {
                this.children[1].style.display = 'block'
            }
        })
        // 移出隐藏
        navOne[i].addEventListener("mouseout", function () {
            if (this.children[1]) {
                this.children[1].style.display = 'none'
            }
        })
    }

    //tab 栏切换
    var list = document.querySelectorAll(".title>p")
    var items = document.querySelectorAll("#dd>div")
    for (var i = 0; i < list.length; i++) {
        list[i].setAttribute('index', i);
        list[i].onclick = function () {
            // 导航栏样式切换，排他算法
            for (var i = 0; i < list.length; i++) {
                list[i].className = '';
                items[i].classList.remove('showq');
            }
            this.className = 'current';
            var ae = this.getAttribute('index');
            // showq 显示
            items[ae].classList.add('showq');
        }
    }
}
